package com.dch;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class MyClose extends HttpServlet{
	@Override
	 protected void doPost(HttpServletRequest req, HttpServletResponse resp)
	   throws ServletException, IOException {
	  doGet(req,resp);
	 }
	
	@Override
	 public void doGet(HttpServletRequest req, HttpServletResponse resp)
	   throws ServletException, IOException {
		String usernames = req.getParameter("usernames");
		String password = req.getParameter("password");
	  System.out.println(usernames);
	  System.out.println(password);
	//  String str = "insert into userinfo(username,address,email,usernames,password) values('"+username+"','"+address+"','"+email+"','"+usernames+"','"+pwd+"')";
		String str = "delete from userinfo where usernames='"+usernames+"' and password='"+password+"';";
		Connection conn = null;
	   Statement st = null;
	   
	   try
	   {
	    Class.forName("com.mysql.jdbc.Driver");
	   }
	   catch(Exception ee)
	   {
	    ee.printStackTrace();
	   }
	   try
	   {
	    conn = (Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/dch","root","123");
	    st = conn.createStatement();
	    st.executeUpdate(str);
	   }
	   catch(Exception eo)
	   {
	    eo.printStackTrace();
	   
	}

	  resp.sendRedirect("14.jsp");
	  return;

	 }

}
